from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep, strftime

driver = webdriver.Firefox()
driver.maximize_window()
driver.get('file:///D:/nsd2404/html/register.html')

# 输入用户名
driver.find_element(By.CSS_SELECTOR, '#user').send_keys('admin')
# 截屏
# 使用时间信息作为文件名称
driver.get_screenshot_as_file(f'../images/{strftime("%Y_%m_%d_%H_%M_%S")}.png')

sleep(3)
driver.quit()